package web.hibernate;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Basic;
import javax.persistence.Column;
import java.util.Arrays;

/**
 * Created by IntelliJ IDEA.
 * User: user
 * Date: Jan 31, 2010
 * Time: 9:15:00 PM
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(catalog = "strutshibernatespring", name = "firm")
public class FirmEntity {
  private long firmId;

  @Basic
  @Column(name = "firm_id", length = 10)
  public long getFirmId() {
    return firmId;
  }

  public void setFirmId(long firmId) {
    this.firmId = firmId;
  }

  private char[] firmRfn;

  @Basic
  @Column(name = "firm_rfn", length = 500)
  public char[] getFirmRfn() {
    return firmRfn;
  }

  public void setFirmRfn(char[] firmRfn) {
    this.firmRfn = firmRfn;
  }

  private char[] firmRsn;

  @Basic
  @Column(name = "firm_rsn", length = 4)
  public char[] getFirmRsn() {
    return firmRsn;
  }

  public void setFirmRsn(char[] firmRsn) {
    this.firmRsn = firmRsn;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    FirmEntity that = (FirmEntity) o;

    if (firmId != that.firmId) return false;
    if (!Arrays.equals(firmRfn, that.firmRfn)) return false;
    if (!Arrays.equals(firmRsn, that.firmRsn)) return false;

    return true;
  }

  @Override
  public int hashCode() {
    int result = (int) (firmId ^ (firmId >>> 32));
    result = 31 * result + (firmRfn != null ? Arrays.hashCode(firmRfn) : 0);
    result = 31 * result + (firmRsn != null ? Arrays.hashCode(firmRsn) : 0);
    return result;
  }
}
